<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%
	System.out.println("------------------------------------");

	java.util.Enumeration en = request.getAttributeNames();
	
	while(en.hasMoreElements()){
		
		String name = (String)en.nextElement();
		
		System.out.println(name + ":" +request.getAttribute(name));
	}

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="<c:url value="/resources/form.css" />" rel="stylesheet"  type="text/css" />	
</head>
<body>

	<form:form id="form" method="post" modelAttribute="bbsVO" cssClass="cleanform">
 
	<div class="header">
 		<h2>Form</h2>
 		<c:if test="${not empty message}">
		<div id="message" class="success">${message}</div>	
 		</c:if>
 		<s:bind path="*">
 			<c:if test="${status.error}">
	  		<div id="message" class="error">Form has errors</div>
 			</c:if>
 		</s:bind>
	</div>
 
<script>
console.log('${vo}');
console.log('${bindingResult}');

</script>
<fieldset>
	<form:label path="title">
		TITLE <form:errors id="bbsVO" path="title" cssClass="error" />
	</form:label>
	
	<form:input path="title" />
	<br/>
	<form:label path="writer">
		WRITER <form:errors path="writer"></form:errors>
	</form:label>
	<form:input path="writer" />
	<br/>
	
	<form:label path="content"><form:errors path="content" cssClass="error"/>
		CONENT 
	</form:label>
	<form:textarea path="content" />	
</fieldset>
	<p><button type="submit">Submit</button></p>	   
   
 </form:form>
</body>
</html>